Re: Speeding up Query
От | Alexander Lohse |
---|---|
Тема | Re: Speeding up Query |
Дата | |
Msg-id | p05100300b725af0d9fff@[192.168.0.89] обсуждение исходный текст |
Ответ на | Re: Speeding up Query (Tom Lane <tgl@sss.pgh.pa.us>) |
Ответы |
Re: Speeding up Query
|
Список | pgsql-general |
>This is pretty horrid: you are generating a cross product of >events * event_ref * teams * orgs * pers and then selecting rows >multiple times out of that very large set. No wonder you lost >patience even with a small test database. I think you wanted >something like > >... >INTERSECT ( > >select events.id from events where >(lower(events.head) like '%web%' > or lower(events.search) like '%web%' > or lower(events.ort) like '%web%' > or lower(events.text) like '%web%' > >union > >select teams.id from teams where >lower(teams.name) like '%web%' > >union > Hi Tom, this thing is a bit more complicated. event_ref is the table containing the relations events <-> teams (One event/multiple Teams) Spoken: Teams or Persons organise Events, that's what: (events.id = event_ref.event_id and event_ref.ref_id = teams.id) is for. Now, this search wants to be able to find all events that are organised by teams, pers, orgs where teams,p,o name contains "search_string". But maybe you already brought the idea to me! Instead of using pleanty of ORs I should try using plenty UNIONs. Would it also possible to make multiple INTERSECTS? How do these operate on each other, do I also use parentheses? I am bit in a hurry, right in the moment that why I write stenograph! ;-) Thank you in advance, Alex -- ___________________________ Human Touch Medienproduktion GmbH Am See 1 17440 Klein Jasedow Alexander Lohse Tel: (038374) 75211 Fax: (038374) 75223 eMail: al@humantouch.de http://www.humantouch.de
В списке pgsql-general по дате отправления: